package com.snack.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.snack.common.core.annotation.Excel;
import com.snack.common.core.web.domain.BaseEntity;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 商品对象 ts_goods
 * 
 * @author snack
 * @date 2022-09-18
 */
@Data
public class TsGoods extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 商品id */
    private Long goodsId;

    /** 商品类型id */
    @NotNull(message = "商品类型不能为空")
    @Excel(name = "商品类型id")
    private Long goodsTypeId;

    /** 商品名称 */
    @NotBlank(message = "商品名称不能为空")
    @Size(min = 0, max = 50, message = "商品名称长度不能超过50个字符")
    @Excel(name = "商品名称")
    private String goodsName;

    /** 条形编码 */
    @NotBlank(message = "条形编码不能为空")
    @Size(min = 0, max = 50, message = "条形编码长度不能超过30个字符")
    @Excel(name = "条形编码")
    private String code;

    /** 品牌 */
    @Excel(name = "品牌")
    private String brand;

    /** 进价 */
    @NotNull(message = "进价不能为空")
    @Excel(name = "进价")
    private BigDecimal priceIn;

    /** 售价 */
    @NotNull(message = "售价不能为空")
    @Excel(name = "售价")
    private BigDecimal priceOut;

    /** 厂家 */
    @Excel(name = "厂家")
    private String factoryName;

    /** 库存 */
    @NotNull(message = "库存不能为空")
    @Excel(name = "库存")
    private Long stock;

    /** 购买时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "购买时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date payDate;

    /** 生产日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date birthDate;

    /** 有效时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "有效时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date validDate;

    /** 头像地址 */
    @NotEmpty(message = "封面图片不能为空")
    private String avatar;

    /** 资源pics */
    @Excel(name = "资源pics")
    private String pics;

    /** 状态（0上架 1下架） */
    @NotEmpty(message = "状态不能为空")
    @Pattern(regexp = "[01]",message = "状态格式错误")
    @Excel(name = "状态", readConverterExp = "0=上架,1=下架")
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;


    /** 商品类型 */
    private TsGoodsType goodsType;
    /** 其他数据 */
    @Valid
    private List<TsGoodsParamData> goodsParamDataList;
    /** 资源 */
    @Valid
    private List<TsResource> resourceList;

}
